"use client";

import { EmptyOrg } from "../_components/empty/empty-org";
import { useOrganization } from "@clerk/nextjs";
import { BoardList } from "../_components/board-list";

interface DashboardPageProps {
  searchParams: {
    search?: string;
    favorites?: string;
  };
}

/**
 * @components 应用程序主界面
 * @description 动态路由组件，可以自动拿到路由里边的参数
 */

const DashboardPage = ({ searchParams }: DashboardPageProps) => {
  const { organization } = useOrganization();

  return (
    <div className="flex-1 h-[calc(100%-80px)] p-6">
      {!organization ? (
        <EmptyOrg />
      ) : (
        <BoardList orgId={organization.id} query={searchParams}></BoardList>
      )}
    </div>
  );
};

export default DashboardPage;
